#ifndef GLIB_RENDERLIST_HY
#define GLIB_RENDERLIST_HY


#include "gTriangle.h"
#include "gDefines.h"
#include "common.h"
#include "memoryDef.h"

#define MAX_FACES_IN_LIST 256

class CRenderList
{
public:
	CTriangleVertex **listIndex;
	CTriangleVertex list[MAX_FACES_IN_LIST];
	int m_faceNum;

public:
	inline CRenderList():
	m_faceNum(0),
	listIndex(NULL)
	{
		memset(list, 0, sizeof(CTriangleVertex)*MAX_FACES_IN_LIST);
	}

	inline ~CRenderList()
	{
		SAFE_DELETE_ARRAY(listIndex);
	}

	inline void AddFace(gVertex3D *a, gVertex3D *b, gVertex3D *c)
	{
		list[m_faceNum].SetVertex(a, b, c);
		list[m_faceNum].SetState(CTriangle::STATE_VISIABLE);
		m_faceNum++;
	}

	inline void SortbyDepth()
	{}

	inline void ResetList()
	{
		memset(list, 0, sizeof(CTriangleVertex)*MAX_FACES_IN_LIST);
		m_faceNum = 0;
		SAFE_DELETE_ARRAY(listIndex);
	}
};

#endif